home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / ttga10.zip / HICOLOR.H < prev    next >
C/C++ Source or Header  |  1992-05-19  |  6KB  |  152 lines

  1. /*
  2.  * HiColor.H
  3.  *
  4.  * Copyright 1990,1991 Synergrafix Consulting
  5.  *          All Rights Reserved.
  6.  *
  7.  * November 19,1991
  8.  *
  9.  */
  10.  
  11. #ifndef HC_INCLUDE
  12.  
  13. #define HC_INCLUDE    1
  14.  
  15. #include <dos.h>
  16. #include <alloc.h>
  17. #include <string.h>
  18.  
  19. #define HC_SVGALO    0   /* 640x350 */ /* Not all modes supported on all */
  20. #define HC_SVGAMED    1   /* 640x400 */ /* graphics hardware!!! */
  21. #define HC_SVGAHI    2   /* 640x480 */
  22. #define HC_SVGAHI2    3   /* 800x600 */
  23.  
  24. #define    XOR    0
  25. #define OR    1
  26. #define COPY    2
  27.  
  28. /* TSENG Modes: 0x2D=640x350; 0x2E=640x480; 0x2F=640x400; 0x30=800x600 */
  29.  
  30. #define FALSE    0
  31. #define TRUE    1
  32.  
  33. #define SCREENSEG    0xA000
  34. #define GCSEGSEL    0x3CD
  35.  
  36. #define DAC_MASK  0x3C6 /* DAC pixel mask reg address, also Sierra
  37.                command reg address when enabled */
  38.  
  39. #define DAC_WADDR 0x3C8  /* DAC write address reg address */
  40.  
  41. typedef unsigned char BYTE;
  42. typedef unsigned int WORD;
  43. typedef unsigned long DWORD;
  44.  
  45. #define RGB256INT(r,g,b)    (WORD)( ( ((r)>>3)<<10 ) | ( ((g)>>3)<<5 ) | ((b)>>3) )
  46. //#define RGB256INT(r,g,b)    (WORD)( _rlu[r] | _glu[g] | _blu[b] )
  47. #define RGBINT(r,g,b)        (WORD)( ((r)<<10) | ((g)<<5) | (b) )
  48. #define INTRED(c)        ((c)>>10)
  49. #define INTGREEN(c)        (((c)<<5)>>10)
  50. #define INTBLUE(c)        ((c)&31)
  51. #define INTRED256(c)        (INTRED(c)<<3)
  52. #define INTGREEN256(c)        (INTGREEN(c)<<3)
  53. #define INTBLUE256(c)              (INTBLUE(c)<<3)
  54. #define SWAP(a,b)        { a^=b; b^=a; a^=b; }
  55.  
  56. #define BANK(b)        { if (b!=hcoldbank) {                   \
  57.                 outp(GCSEGSEL, (b<<4)|b);       \
  58.                 hcoldbank=b;                    \
  59.                 }                               \
  60.             }
  61.  
  62. #define DOBANK        BANK(*(((WORD *)&hcbitmap)+1));
  63.  
  64. extern WORD hcoldbank;
  65. extern DWORD hcbitmap;
  66. //extern WORD _rlu[256],_glu[256],_blu[256];
  67.  
  68. /* HICOLOR.C 19/12/91 10.11.22 */
  69.  
  70. int hicolorDAC (void);
  71. int tseng4000 (void);
  72. int hcsetmodetseng (int Mode);
  73. int hcmodesize(int picwidth,int picheight);
  74. void hctextmode (void);
  75. void hcputpoint (WORD x, WORD y, WORD color);
  76. void hcputpointxor (WORD x, WORD y, WORD color);
  77. void hcputpointrgb (WORD x, WORD y, WORD r, WORD g, WORD b);
  78. WORD rgb265int (WORD r, WORD g, WORD b);
  79. WORD rgbint (WORD r, WORD g, WORD b);
  80. void intrgb256 (WORD color, WORD *r, WORD *g, WORD *b);
  81. void intrgb (WORD color, WORD *r, WORD *g, WORD *b);
  82. WORD hcgetpoint (WORD x, WORD y);
  83. void hcgetpointrgb (WORD x, WORD y, WORD *r, WORD *g, WORD *b);
  84. WORD hcgetmaxx (void);
  85. WORD hcgetmaxy (void);
  86. void hchline (WORD x, WORD y, WORD x1, register WORD color);
  87. void hcvline (WORD x, WORD y, WORD y1, register WORD color);
  88. void hchlinexor (WORD x, WORD y, WORD x1, register WORD color);
  89. void hcvlinexor (WORD x, WORD y, WORD y1, register WORD color);
  90. void hcrectangle (WORD x, WORD y, WORD x1, WORD y1, WORD color);
  91. void hcrectanglexor (WORD x, WORD y, WORD x1, WORD y1, WORD color);
  92. void hcline(int a1, int b1, int a2, int b2, WORD lcolor);
  93. void hclinexor(int a1, int b1, int a2, int b2, WORD lcolor);
  94. void hccircle(WORD xc,WORD yc,WORD rad,WORD color);
  95. void hcfillcircle(WORD xc,WORD yc,WORD rad,WORD color);
  96. void hcbar (WORD x, WORD y, WORD x1, WORD y1, register WORD color);
  97. void hcclrscr (WORD color);
  98. void hcputrow (WORD x, WORD y, register WORD w, register WORD *buf);
  99. void hcputrowxor (WORD x, WORD y, register WORD w, register WORD *buf);
  100. void hcputrowor (WORD x, WORD y, register WORD w, register WORD *buf);
  101. void hcgetrow (WORD x, WORD y, register WORD w, register WORD *buf);
  102. DWORD hcgetimagesize (register WORD left, register WORD top, register WORD right,register WORD bottom);
  103. void hcgetimage (WORD left, WORD top, WORD right, WORD bottom, WORD *bitmap);
  104. void hcputimage (WORD left, WORD top, WORD *bitmap, WORD drawtype);
  105. void hcputchr (unsigned char ch, WORD xpos, WORD ypos, WORD fg, WORD background);
  106. void hcputstr (char *str, WORD xpos, WORD ypos, WORD fg, WORD background);
  107. void hcfill(int x,int y,int ncolor);
  108. void hcpfill(int x,int y,int bordcol,WORD *pat,int pw,int ph);
  109. WORD *hcimagetopattern(WORD *bitmap,WORD *w,WORD *h);
  110.  
  111. /* MOUSE.C */
  112.  
  113. #define GRCURSORSIZEX    11    /* Max. graphics cursor width in pixels */
  114. #define GRCURSORSIZEY    15    /* Max. cursor height in pixels + 1 */
  115. #define GRCURSORNUM    10    /* Max number of default and definable cursors */
  116.  
  117. #define ARROWCURSOR        0    /* Graphics cursor types */
  118. #define SMALLARROWCURSOR    1
  119. #define CROSSHAIR        2
  120. #define SMALLCROSSHAIR        3
  121. #define DIAGCROSSHAIR        4
  122.  
  123. typedef int    grcursortype[GRCURSORSIZEX][GRCURSORSIZEY];
  124. typedef char    mousestr[80];
  125.  
  126.        /* Mouse driver control */
  127.  
  128. int  initmouse(void);                /* Init. mouse driver */
  129. void showmouse(void);                /* Show (text) cursor */
  130. void hidemouse(void);                /* Unshow (text) cursor */
  131. void getmouse(int *x,int *y,int *buttons);/* Get position */
  132. void putmouse(int x,int y);            /* Place mouse */
  133. void getmousebuttonon(int button,int *buttonstate,
  134.               int *numpresses,int *x,int *y);/* Get buttons pressed */
  135. void getmousebuttonoff(int button,int *buttonstate,
  136.                int *numreleases,int  *x,int *y);/* Get buttons released */
  137. void setmouserange(int x,int y,int x1,int y1);    /* Set range */
  138. void getmousemotion(int *x,int *y);        /* Get movement */
  139. void setmousemove(int x,int y);            /* Set sensitivity */
  140.  
  141.        /* Mouse cursor routines for BGI Graphics */
  142.  
  143. void setgrcursor(int index,grcursortype newgrcursor);/* Set cursor bitmap */
  144. void putgrcursor(int x,int y);        /* Place graphics cursor */
  145. void unputgrcursor(void);        /* Remove graphics cursor */
  146. int getgrcursorx(void);                 /* Get current postn */
  147. int getgrcursory(void);
  148. int initgrcursor(int grcursorindex,int color);/* Init. graphics cursor */
  149. void closegrcursor(void);
  150.  
  151. #endif
  152.